package com.shrw.duke.serialport.shengbenserial.port;


import com.shrw.duke.serialport.listener.PortDataListener;
import com.shrw.duke.serialport.shengbenserial.listener.ReadReturnDataListener;

/**
 * Created by rw-duke on 2018/5/21.
 */

public abstract class Port {
    private PortDataListener readReturnDataListener;

    public void callReadReturnDataListenerOnReported(byte[] tempBuf) {
        if (this.readReturnDataListener != null) {
            this.readReturnDataListener.onPortData(tempBuf);
        }
    }

    public void setReadReturnDataListener(
            PortDataListener _readReturnDataListener) {
        readReturnDataListener = _readReturnDataListener;
    }

    public abstract void stop();
    public abstract void start();

    public void resume(){};
    public void pause(){};

    public abstract boolean sendCommd(byte[] cmd);

}
